<?php

/**
 * Teacher form.
 *
 * @package    sf_sandbox
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormTemplate.php 23810 2009-11-12 11:07:44Z Kris.Wallsmith $
 */
class TeacherForm extends BaseTeacherForm {

    public function configure() {

        unset(
                $this['intg_identity2']
                , $this['sub_id']
                , $this['q_id']
                , $this['nat_id']
                , $this['job_id']
                , $this['created_by_user_id']
                , $this['updated_by_user_id']
                , $this['emp_status']
                , $this['q_date']
                , $this['is_hanged']
                , $this['hange_status']
                , $this['birth_date']
                , $this['program_list']
        );

        $this->widgetSchema['intg_identity'] = new sfWidgetFormInput();
        $this->validatorSchema['intg_identity'] = new sfValidatorNumber(array('required' => true));
        $this->validatorSchema->setPostValidator(
                new sfValidatorAnd(array(
                    new sfValidatorDoctrineUnique(array('required' => true, 'model' => 'Teacher', 'column' => 'intg_identity', 'object' => $this->getObject()))
                )));

        $this->getWidget('school_intg_id')->setOption('key_method', 'getIntgId');
        $this->getWidget('school_intg_id')->setOption('order_by', array('name', 'asc'));
        $this->getValidator('school_intg_id')->setOption('column', 'intg_id');

        //$link_programs = TeacherTable::getInstance()->getLinkTeacherProgram();
//      $this->widgetSchema['program_list'] = new sfWidgetFormDoctrineChoice(array('multiple' => true, 'model' => 'Teacher','key_method' => 'getPrograms','method' => 'getPrograms'));
        //$this->validatorSchema['program_list']  = new sfValidatorChoice(array('multiple' => true, 'choices' => array_keys($link_programs)));


        $this->setCustomFormatter(); // to display form with stars
    }

}
